package io.yuanqi.hgtcshop.controller;

import io.yuanqi.hgtcshop.entity.dos.Category;
import io.yuanqi.hgtcshop.service.CategoryService;
import io.yuanqi.hgtcshop.entity.vo.ResultMessage;
import io.yuanqi.hgtcshop.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * CategoryBuyerController {@link }
 *
 * @author: J.S
 * @since: 2024/1/26
 */
@RestController
@RequestMapping("/buyer/goods/category")
public class CategoryBuyerController {
    @Autowired
    private CategoryService categoryService;

//    @ApiOperation(value = "获取商品分类列表")
//    @ApiImplicitParam(name = "parentId", value = "上级分类ID，全部分类为：0", required = true, dataType = "Long", paramType = "path")
    @GetMapping(value = "/get/{parentId}")
    public ResultMessage<List<Category>> list(@NotNull(message = "分类ID不能为空") @PathVariable String parentId) {

        return ResultUtil.data(categoryService.dbList(parentId));
    }
}
